package my.package001

import fundation.gsonPrintln

/**
 * @author futao
 * Created on 2017/11/14 - 19:50.
 */
data class Point(var x: Int, var y: Int)

operator fun Point.get(index: Int): Int = when (index) {
    0 -> this.x
    1 -> this.y
    else -> throw Exception("1231232")
}
operator fun Point.set(index: Int, value: Int) {
    when (index) {
        0 -> this.x = value
        1 -> this.y=value
    }
}

fun main(args: Array<String>) {
    for (i in 1.rangeTo(100)){

    }
    val point = Point(100, 222)
    gsonPrintln(point[0])
    gsonPrintln(point[1])
    point[0] = 999
    point[1]=6666
    gsonPrintln(point)
}
